package com.javaAPI.demo7;

import java.util.Scanner;

public class Test2 {
    public static void main(String[] args) {
        /**
         * 遍历字符串
         * 底层通过char[]实现
         * charAt(0)根据下标获取对应的字符
         */
        //1.键盘输入字符串
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入一个字符串");
        String str = scanner.nextLine();
//        str.length();//获取字符串长度，底层是返回char[]数组长度
        for (int i = 0; i < str.length(); i++) {
            System.out.println(str.charAt(i));
        }


    }
}
